home *** CD-ROM | disk | FTP | other *** search
/ NeXT Enterprise Objects Framework 1.1 / NeXT Enterprise Objects Framework 1.1.iso / NextDeveloper / Headers / eoadaptors / Sybase / SybaseChannel.h < prev    next >
Encoding:
Text File  |  1995-01-04  |  3.6 KB  |  117 lines

  1. //  SybaseAdaptor.h
  2. //  Copyright 1994, NeXT Computer, Inc.
  3.  
  4. #import    <eoaccess/eoaccess.h>
  5. #import <sybfront.h>
  6. #import <sybdb.h>
  7.  
  8. @class SybaseAdaptor;
  9. @class SybaseContext;
  10.  
  11. typedef enum
  12. {
  13.     SybaseRegularRow,
  14.     SybaseComputeRow,
  15.     SybaseReturnParameterRow,
  16.     SybaseReturnStatusRow
  17. } SybaseRowType;
  18.  
  19. typedef enum
  20. {
  21.     SybaseRowFetch,
  22.     SybaseReturnParameterFetch,
  23.     SybaseReturnStatusFetch,
  24.     SybaseTerminatedFetch
  25. } SybaseFetchState;
  26.  
  27. @interface SybaseChannel:EOAdaptorChannel
  28. {
  29.     DBPROCESS *_dbProcess;
  30.     SybaseAdaptor *_adaptor;
  31.     SybaseContext *_adaptorContext;
  32.     SybaseRowType _rowType;
  33.     SybaseFetchState _fetchState;
  34.     int _computeRowId; // only valid when _resultType == SybaseComputeRow;
  35.     int _severityLevelToIgnore;
  36.     NSArray *_columns;
  37.     NSArray *_attributesForColumns;
  38.     struct
  39.     {
  40.     unsigned fetchInProgress:1;
  41.     unsigned logsErrors:1;
  42.     unsigned logsMessages:1;
  43.     unsigned shareDBProcesses:1;
  44.     unsigned relinquishDBProcessAfterFetch:1;
  45.     unsigned isOpen:1;
  46.     unsigned _RESERVED:25;
  47.     } _flags;
  48.  
  49. @public
  50.     struct {
  51.     unsigned willFetchAttributes:1;
  52.     unsigned willReturnRow:1;
  53.     unsigned willReportMessage:1;
  54.     unsigned willReportError:1;
  55.     unsigned _RESERVED:28;
  56.     } _sybaseDelegateRespondsTo;
  57. }
  58.  
  59. - (BOOL)logsErrors;
  60.     // YES if adaptor logs errors for this channel. logsErrors is set to YES
  61.     // by default.
  62. - (void)setLogsErrors:(BOOL)yn;
  63.     // If set to YES Sybase adaptors will log errors for this channel with
  64.     // severity greater than severityLevelToIgnore.
  65.     
  66. - (BOOL)logsMessages;
  67.     // YES if adaptor logs messages for this channel. logsMessages is set
  68.     // to YES by default.
  69. - (void)setLogsMessages:(BOOL)yn;
  70.     // If set to YES Sybase adaptors will log messages for this channel with
  71.     // severity greater than severityLevelToIgnore.
  72.  
  73. - (int)severityLevelToIgnore;
  74.     // Returns severity level of messages and errors that will be ignored by
  75.     // the default error and message handling routines. The default value for
  76.     // severityLevelToIgnore is 0.
  77. - (void)setSeverityLevelToIgnore:(int)severityLevel;
  78.     // Sybase channels will ignore any messages and errors with
  79.     // severity <= severityLevelToIgnore.
  80.  
  81. - initWithAdaptorContext:(SybaseContext *)adaptorContext;
  82.  
  83. @end
  84.  
  85. @interface NSObject(SybaseChannelDelegation)
  86.  
  87. - (NSArray *)sybaseChannel:(SybaseChannel *)channel
  88.     willFetchAttributes:(NSArray *)attributes
  89.     forRowOfType:(SybaseRowType)rowType
  90.     withComputeRowId:(int)computeRowId;
  91.     // Invoked whenever a row fetched, the delegate can return nil which
  92.     // will cause the row to be skipped, or replace the attributes with a
  93.     // set of attributes that is appropriate for the type of row that is
  94.     // being fetched. Delegates can have the channel fabricate a set of
  95.     // attributes for the current non-regular row by calling describe
  96.     // attributes at this point.
  97.     
  98. - (BOOL)sybaseChannel:(SybaseChannel *)channel
  99.     willReturnRow:(NSDictionary *)row ofType:(SybaseRowType)rowType 
  100.     withComputeRowId:(int)computeRowId;
  101.     // Invoked once a row has been read in an packaged into the dictionary.
  102.     // Delegates return YES to cause the row to be returned from
  103.     // fetchAttributes:WithZone: or they can return NO to cause the row to
  104.     // be skipped.
  105.     
  106. - (BOOL)sybaseChannel:(SybaseChannel *)channel
  107.     willReportMessageWithNumber:(int)msgNo msgState:(int)msgState
  108.     severity:(int)severity msgText:(char *)msgText srvname:(char *)srvname
  109.     procname:(char *)procname lineno:(int)lineno;
  110.     
  111. - (BOOL)sybaseChannel:(SybaseChannel *)channel
  112.     willReportErrorWithNumber:(int)dbErr severity:(int)severity
  113.     osErr:(int)osErr dbErrText:(char *)dbErrText osErrText:(char *)osErrText;
  114.     
  115. @end
  116.  
  117.